import type { Unit } from './common'
// 入库单
// 获取入库单主表参数接口
export interface InStoreBillPageParams {
	page: number
	rows: number
	r: {
		businessDate: string[]
	}
	orl: {
		sysBillCode: string,
		userBillCode: string
	},
	i: {
		billState?: (number | string)[]
		billType: (number | string)[]
		organId: (number | string)[]
		otherOrganId: (number | string)[]
		checkAcceptStatus: (number | string)[]
	},
	o: {
		businessDate: string,
		sysBillCode: string
	}
}
// 业务日期区间接口
export interface BusinessDate {
	begin: string
	end: string
}
export interface FilterInOrgan {
	id: string
	name: string
}
// 入库单筛选条件接口
export interface InStoreFilterData {
	businessDate: string[]
	detailInOrganId: string[]
	detailOtherOrganId: string[]
	checkAcceptStatus: string[]
}
// 选项接口
export interface OrganItem {
	id: string
	name: string
}
// 选项接口
export interface ItemWeighType {
	id: number | string
	name: string
}
// 单据类型选项接口
export interface BillTypeSelectItem {
	id: number
	name: string
	visibleFlag: boolean
}
// 附件队列接口
export interface AppendicesItem {
	appendixUrl: string
}
// 品项类别接口
export interface ItemType {
	id: string
	name: string
	children?: ItemType[]
}
// 品项单位接口
export interface ItemUnit extends Partial<Unit> { }

// 品项明细接口
export interface ItemDetail {
	id: string
	billId?: string
	item: {
		id?: string
		name?: string
		itemType?: string
		canWeigh?: number
		assistUnit?: string
		itemUnitList?: ItemUnit[]
		code?: string
		spec?: string
		itemTypeRef?: {
			name: string
		}
		shelfLife?: number
		storageMethod?: number
		shelfLifeFlag?: boolean
		imageUrl?: string
		kgToMainUnit?: number,
		weighRecords?: object[]
	}
	amount?: number
	itemUnit?: ItemUnit
	inHouse?: {
		id?: string
		name?: string
	}
	outHouse?: {
		id: string
		name: string
	},
	inTaxPrice?: number
	lastTaxPrice?: number
	inPrice?: number
	lastPrice?: number
	inTaxMoney?: number
	inMoney?: number
	taxRate?: number
	strategy?: number
	checked?: boolean
	checkAccept?: number
	stock?: number
	assistUnit?: string
	assistUnitAmount?: number | string
	weightList?: object[]
	productDate?: string
	memo?: string
	rootItemType?: ItemType
	weighRecords?: object[]
	weighImages?: object[]
	weighCountFlag?: number
	price?: number
	money?: number
	inTaxRateMoney?: number
	batchCode?: number
	expectArrivalDate?: string
	storageMethod?: number
	originalAmount?: number
	$fxCalculation?: string
	giftFlag?: boolean
	preDetailIsAssistUnit?: boolean
	freight?: string
	stockOrderAmount?: number
	stockOrderOutAmount?: number
	srmSendAmount?: number
	fxSortNum?: number
	outStockSign?: number
	padStockOrderAmount?: number
	padStockOrderItemUnit?: ItemUnit
	mergeBatchPadMinItemUnitAmount?: number
	mergeBatchPadMinItemUnit?: ItemUnit
	// 是否pad端上传
	updatePadFlag?: boolean
	moneyChange?: boolean
	outStockReason?: object,
	weighNetWeight?: number,
	weighTareWeight?: number,
	weighGrossWeight?: number
}
// 单据类型接口
export interface BillTypeItem {
	id: number
	name: string
	visibleFlag: boolean
}
// 单据业务类型接口
export interface BillBizTypeItem {
	id: string
	name: string
}
// 未分拣品项信息接口
export interface ItemInfo {
	id: string
	name: string
	itemType: string
	canWeigh: number
	assistUnit: string
	itemUnitList: ItemUnit[]
	rootItemType: ItemType
	pinYin?: string
}
// 单据信息接口
export interface BillDetail {
	id: string
	autoType: number,
	billSign?: number
	billType: number
	billClass?: string
	subBillType: number
	billTypeName: string
	billState: number
	checkAcceptStatus?: number
	recheckState?: number
	sysBillCode: string
	businessDate: string
	singleHouseFlag: number
	billBizType: {
		id: string
		name: string
	}
	billBizTypeId: string
	inOrgan: {
		id: string
		name?: string
	}
	otherOrgan: {
		id: string
		organType?: string
		name?: string
	}
	inHouse: {
		id: string
		name?: string
	}
	operateMan: {
		id: string
		name?: string
	}
	version: number
	details: ItemDetail[]
	appendixes: AppendicesItem[]
	userBillCode?: string
	memo?: string
	carriageFee: number
	detailAmount: number
	noInStoreItems?: ItemInfo[]
	noInStoreItemDetails?: ItemDetail[]
	noInStoreDetails?: ItemDetail[]
	inStoreTypes?: ItemType[]
	noStoreTypes?: ItemType[]
	weightItemTypeTree?: ItemType[]
	noWeightItemTypeTree?: ItemType[]
	itemUnit?: ItemUnit
	parentBill?: object
	actualSellerId: number
	actualSellerName: string
	sortNum?: number
}

// 品项价格接口
export interface PriceData {
	price: number
	refPrice: boolean
	strategy: number
	taxPrice: number
	taxRate: number
	unitId: string
}
// tag选项接口
export interface TagSelectItem {
	id: string | number
	label: string
}
// 品项数据接口
export interface ItemData {
	id: string
	itemUnit?: ItemUnit
	item: {
		id?: string
		name?: string
		assistUnit?: string
		shelfLifeFlag?: boolean
		shelfLife?: string
		imageUrl?: string
		spec?: string
	}
	amount: number
	originalAmount: number
	$fxCalculation: string
	taxRate: number
	inTaxPrice: number
	inPrice: number
	inTaxMoney: number
	inMoney: number
	inHouse: Record<string, unknown>
	giftFlag: boolean
	preDetailIsAssistUnit: boolean
	batchCode?: string
	stock?: string
	freight?: string
	outHouse?: Record<string, unknown>
	productDate?: string
	assistUnitAmount?: number
	memo?: string
}
// 入库仓库数据接口
export interface InHouseItem {
	id: string
	name: string
}
// 异常警告返回值接口
export interface MistakeCheckResponse {
	checkResult: boolean
	errorDetailList: []
	minStep: string
}

// vueRef类
// 异常警告vue实例接口
export interface MistakeCheckRef {
	mistakeCheck: (type: string) => void
	showMistakeCheck: boolean
}
// 称重面板vue实例接口
export interface ScalesContainerRef {
	openScales: (detailsList: ItemDetail[], item: ItemDetail) => void
}

// 按出库方收货——出库方数据接口
export interface OtherOrganItem {
	organId: string
	organName: string
	weighCountFlag: number,
	checked: boolean,
	billIds: []
}

// 按出库方收货——品项数据接口
export interface InBatchItemInfo {
	id: string
	canWeigh: number
	itemName: string
	itemTypeId: string
	itemTypeName: string
	pinYin: string
	weighCountFlag: number
	uniqueId: string
	weighCount: number
	sumDetailAmount: number
	padStockOrderAmount: number
	padStockOrderItemUnit?: ItemUnit
	mergeBatchPadMinItemUnit?: ItemUnit
	mergeBatchPadMinItemUnitAmount?: number
	fxSortNum?: number
	kgToMainUnit?: number
	inStoreDetailIds?: []
}
// 缺货原因
export interface OutStockReason {
	reasonType: number
	reason: string
}
// 供货商评价
export interface SupplierRate {
	speed: number,
	quality: number,
	driverService: number,
	memo?: string
}
